package com.winter.plugin;

import com.winter.plugin.vo.DataVo;

import javax.swing.*;

public class ListPanel extends JPanel {

    private final JPanel infoPanel;
    private final JPanel descPanel;

    public ListPanel(DataVo item) {
        setLayout(new BoxLayout(this,  BoxLayout.Y_AXIS));

        infoPanel = new JPanel();
        infoPanel.setLayout(new BoxLayout(infoPanel,  BoxLayout.X_AXIS));
        JLabel author = new JLabel();
        author.setText(item.getAuthor());
        infoPanel.setAlignmentX(JComponent.LEFT_ALIGNMENT);
        infoPanel.add(author);

        JLabel date = new JLabel();
        date.setText(item.getDate());
        infoPanel.add(date);

        JButton button = new JButton("button");
        infoPanel.add(button);

        descPanel = new JPanel();
        JLabel message = new JLabel();
        message.setText(item.getMessage());
        descPanel.setAlignmentX(JComponent.LEFT_ALIGNMENT);
        descPanel.add(message);


        add(infoPanel);
        add(descPanel);
    }

}
